﻿// ===============================================================================
// DotNet.Platform 开发框架 2016 版权所有
// ===============================================================================

using System.Threading.Tasks;

namespace XNWebService
{
    /// <summary>
    /// 航班时刻查询
    /// </summary>
    public class FlightService
    {
        /// <summary>
        /// 航班时刻查询
        /// </summary>
        /// <param name="dep">出发机场代码，（如:BJS，机场代码，可在国际航班城市列表中查询）</param>
        /// <param name="arr">到达机场代码，（如:MYC）</param>
        /// <param name="date">查询日期（格式：yyyyMMdd, 如：20141118）</param>
        /// <param name="pageNum">查询页码，默认为1，每页返回20条记录</param>
        /// <returns>返回结果Json字符串</returns>
        public static async Task<string> FlightSearch(string dep, string arr, string date,int pageNum)
        {
            var client = API.HttpClient;
            var url = " http://apis.haoservice.com/plan/InternationalFlightQueryByCity?key=af9af594629243b182a37a73f3d0e326";
            var param = $"&dep={dep}&arr={arr}&date={date}&pageNum={pageNum}";
            return await client.GetStringAsync(url + param);
        }
    }
}